<!--
 * @Author: xjt
 * @Date: 2021-06-24 23:31:52
 * @LastEditTime: 2021-06-24 23:32:17
 * @Description: 隔离人员综合查询  全市集中隔离点人员动态情况
 * @LastEditors: xjt
-->
<template>
	<basic-container v-loading="loading" element-loading-text="数据加载中...">
		<el-date-picker value-format="yyyy-M-d H:m:s" v-model="useStartTime" type="datetime" placeholder="选择日期时间">
		</el-date-picker>
		<el-button @click="search()" type="primary">搜索</el-button>
		<el-button @click="download()" type="primary">导出</el-button>


		<el-table :data="tableData" style="width: 100%" ref="multipleTable" id="out-table">
			<el-table-column prop="areaName" label="行政区域" width="100">
			</el-table-column>
			<el-table-column prop="enableCount" label="启用(个）" width="70">
			</el-table-column>
			<el-table-column label="工作人员（人）">
				<el-table-column prop="gzryZyCount" label="转运" width="50">
				</el-table-column>
				<el-table-column prop="gzryJdCount" label="酒店" width="50">
				</el-table-column>
				<el-table-column prop="gzryMjCount" label="民警" width="50">
				</el-table-column>
				<el-table-column prop="gzryXsCount" label="消杀" width="50">
				</el-table-column>
				<el-table-column prop="gzryAbCount" label="安保" width="50">
				</el-table-column>
				<el-table-column prop="gzryYlCount" label="医疗" width="50">
				</el-table-column>
				<el-table-column prop="gzrySjCount" label="数据" width="50">
				</el-table-column>
				<el-table-column prop="gzryQtCount" label="其他" width="50">
				</el-table-column>
				<el-table-column prop="gzryTotal" label="总计" width="50">
				</el-table-column>
			</el-table-column>
			<el-table-column label="隔离人数（人）">
				<el-table-column prop="glryAddCount" label="新增" width="50">
				</el-table-column>
				<el-table-column prop="glryJiechuCount" label="到期解除" width="50">
				</el-table-column>
				<el-table-column prop="glryXianyouCount" label="现有" width="50">
				</el-table-column>
			</el-table-column>
			<el-table-column label="隔离人员类别">
				<el-table-column prop="date" label="内地" width="50">
					<el-table-column prop="ndAddCount" label="新增" width="50">

					</el-table-column>
					<el-table-column prop="ndJiechuCount" label="到期解除" width="50">

					</el-table-column>
					<el-table-column prop="ndXianyouCount" label="现有" width="50">

					</el-table-column>
				</el-table-column>
				<el-table-column prop="date" label="香港" width="50">
					<el-table-column prop="xgAddCount" label="新增" width="50">

					</el-table-column>
					<el-table-column prop="xgJiechuCount" label="到期解除" width="50">

					</el-table-column>
					<el-table-column prop="xgXianyouCount" label="现有" width="50">

					</el-table-column>
				</el-table-column>
				<el-table-column prop="date" label="澳门" width="50">
					<el-table-column prop="amAddCount" label="新增" width="50">

					</el-table-column>
					<el-table-column prop="amJiechuCount" label="到期解除" width="50">

					</el-table-column>
					<el-table-column prop="amXianyouCount" label="现有" width="50">

					</el-table-column>
				</el-table-column>
				<el-table-column prop="date" label="台湾" width="50">
					<el-table-column prop="twAddCount" label="新增" width="50">

					</el-table-column>
					<el-table-column prop="twJiechuCount" label="到期解除" width="50">

					</el-table-column>
					<el-table-column prop="twXianyouCount" label="现有" width="50">

					</el-table-column>
				</el-table-column>
				<el-table-column prop="date" label="外籍" width="50">
					<el-table-column prop="wjAddCount" label="新增" width="50">

					</el-table-column>
					<el-table-column prop="wjJiechuCount" label="到期解除" width="50">

					</el-table-column>
					<el-table-column prop="wjXianyouCount" label="现有" width="50">

					</el-table-column>
				</el-table-column>
			</el-table-column>
			<el-table-column label="有犯罪前科和违法记录">
				<el-table-column prop="fzAddCount" label="新增" width="50">
				</el-table-column>
				<el-table-column prop="fzJiechuCount" label="解除" width="50">
				</el-table-column>
				<el-table-column prop="fzXianyouCount" label="现有" width="50">
				</el-table-column>
			</el-table-column>
			<el-table-column label="表现异常">
				<el-table-column prop="ycAddCount" label="新增" width="50">
				</el-table-column>
				<el-table-column prop="ycJiechuCount" label="解除" width="50">
				</el-table-column>
				<el-table-column prop="ycXianyouCount" label="现有" width="50">
				</el-table-column>
			</el-table-column>
			<el-table-column label="在逃人员">
				<el-table-column prop="ztAddCount" label="新增" width="50">
				</el-table-column>
				<el-table-column prop="ztJiechuCount" label="解除" width="50">
				</el-table-column>
				<el-table-column prop="ztXianyouCount" label="现有" width="50">
				</el-table-column>
			</el-table-column>
		</el-table>
	</basic-container>
</template>

<script>
	import {queryAll,exportAll} from "@/views/yq-totalSearch/api/receive.js";
	export default {
		data() {
			return {
				// 页面loading
				loading: false,
				tableData: [],
				useStartTime: '',
				// paramsTime: {useStartTime: ''},
				pickerOptions: {
					shortcuts: [{
						text: '今天',
						onClick(picker) {
							picker.$emit('pick', new Date());
						}
					}, {
						text: '昨天',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() - 3600 * 1000 * 24);
							picker.$emit('pick', date);
						}
					}, {
						text: '一周前',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
							picker.$emit('pick', date);
						}
					}]
				},
				value1: '',
				value2: '',
				value3: ''
			}
		},
		created() {
			// 数据请求
			// queryData () {
			// this.loading = true;
			// let requestData = { ...this.params, ...params };
			queryAll()
				.then(res => {
					// const { current, size, total, records } = res.data.data;
					console.log(res)
					this.tableData = res.data.data.statisticalData;
					console.log(this.tableData)
				})
				.finally(() => {
					this.loading = false;
				});
			// },
		},
		methods: {
			download() {
				this.publicExport(
					'xzczxdddc',
					'/statistical/export/personnel/dynamic', {},
					'xls',
					'get'
				);
			},
			search() {
				let useStartTime = this.useStartTime;
				// let jsonObj = JSON.parse(useStartTime);
				// console.log(jsonObj)
				let date = new Date();
				
				let year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
				let month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
				let day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
				
				let hours = date.getHours(); //小时 ,返回 Date 对象的小时 (0 ~ 23)
				let minutes = date.getMinutes(); //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
				let seconds = date.getSeconds(); //秒 ,返回 Date 对象的秒数 (0 ~ 59)   
				
				//获取当前系统时间  
				let currentDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
				if (useStartTime > currentDate) {
					this.$message.error("时间不能超过当前时间")
				}else if (useStartTime.length == 0) {
					this.$message.error("请输入搜索时间")
				} else {
					// debugger
					let params = {useStartTime:this.useStartTime};
					// console.log(params)
					queryAll(params)
						.then(res => {
							// debugger
							console.log(res)
							this.tableData = res.data.data.statisticalData;
							console.log(this.tableData)
						})
						.finally(() => {
							this.loading = false;
						});
				}
				
			}

		}
	}
</script>

<style lang="scss" scoped>
	.el-input {
		width: 30%;
		padding: 20px;
	}
</style>
